{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![Logo](https://kite.com/kite-public/kite-plus-jlab-scaled.png)\n",
    "\n",
    "### Welcome to Kite's JupyterLab extension tutorial\n",
    "\n",
    "Kite gives you **ML-powered autocompletions** and **rich documentation** inside JupyterLab. This guide will teach you everything you need to know about Kite in 5 minutes or less.\n",
    "\n",
    "> 💡 _**Tip:** You can open this file at any time with the command `Kite: Open Tutorial` in JupyterLab's command palette._\n",
    "\n",
    "#### Before we start...\n",
    "\n",
    "Make sure that the Kite icon at the bottom of the window reads `Kite: ready`.\n",
    "\n",
    "![Kite icon](https://kite.com/kite-public/kite-status.png)\n",
    "\n",
    "* If it says `Kite: not running`, please start the Kite Engine first.\n",
    "* If it says `Kite: not installed`, please [download and install Kite](https://kite.com/download) first."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Part 1: Autocompletions\n",
    "\n",
    "**Step 1a**<br/>\n",
    "Run the code cell below with all the necessary imports 👇"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Run me!\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Step 1b**<br/>\n",
    "Let's try typing out some code to plot a sine graph. As you type, Kite will automatically show you completions for what you're going to type next.\n",
    "\n",
    "![Autocompletions](https://www.kite.com/kite-public/kite-jlab-autocompletions.gif)\n",
    "\n",
    "> 💡 _**Tip:** You can turn completions docs on and off in JupyterLab's command palette with the command `Kite: Toggle Docs Panel`._\n",
    "\n",
    "> 💡 _**Tip:** The starred completions ★ are from Kite Pro. You can [start your free Kite Pro trial](https://www.kite.com/pro/trial/) anytime. Afterwards, if you choose not to upgrade, you can still use Kite 100% for free._\n",
    "\n",
    "Try typing out the code yourself to see Kite's autocompletions in action.<br/>\n",
    "\n",
    "```python\n",
    "x = np.linspace(-np.pi, np.pi, 50)\n",
    "y = np.sin(x)\n",
    "plt.plot(x, y)\n",
    "```\n",
    "\n",
    "Type this code in the cell below 👇"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Put code in me\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Part 2: Manual completions\n",
    "\n",
    "You can still use JupyterLab's builtin kernel completions. These are particularly useful when you need to access a `DataFrame`'s column names.\n",
    "\n",
    "**Step 2a**<br/>\n",
    "First, run the code cell below to get some sample data to store in a `DataFrame` 👇"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Run me!\n",
    "url = 'https://kite.com/kite-public/iris.csv'\n",
    "df = pd.read_csv(url)\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Step 2b**<br/>\n",
    "Let's plot a scatter graph of sepal length vs. sepal width. When you are accessing a `DataFrame`'s columns, you'll still need to hit `tab` to request completions from the kernel.\n",
    "\n",
    "![Manual completions](https://www.kite.com/kite-public/kite-jlab-manual-completions.gif)\n",
    "\n",
    "Try requesting kernel completions yourself.\n",
    "\n",
    "```python\n",
    "plt.scatter(df['sepal_length'], df['sepal_width'])\n",
    "```\n",
    "\n",
    "Type this code in the cell below, making sure to hit `tab` when you are filling in the column names 👇"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Put code in me\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Part 3: Copilot Documentation\n",
    "\n",
    "If you've enabled \"docs following cursor\" in the Copilot, the Copilot will automatically update with the documentation of the identifier underneath your cursor.\n",
    "\n",
    "![Autosearch](https://www.kite.com/kite-public/kite-jlab-autosearch.gif)\n",
    "\n",
    "**Step 3a**<br/>\n",
    "Try it yourself! Just click around in the code cells of this notebook and see the Copilot update automatically."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### The End\n",
    "\n",
    "Now you know everything you need to know about Kite's JupyterLab plugin. Kite is under active development and we expect to ship improvements and more features in the near future.\n",
    "\n",
    "In the meantime, if you experience bugs or have feature requests, feel free to open an issue in our [public GitHub repo](https://github.com/kiteco/issue-tracker).\n",
    "\n",
    "Happy coding!"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  },
  "toc-autonumbering": false,
  "toc-showcode": false,
  "toc-showmarkdowntxt": false,
  "toc-showtags": false
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
